package com.fan.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fan.web.service.HService;

@Controller
public class HelloWorld {

	@Autowired
	private HService hService;
	
	@RequestMapping(value = "/helloworld",method=RequestMethod.GET)
	public String hello() {
		System.out.println("hello world");

		return "success";
	}
	
	@RequestMapping(value = "/ceshi", method= RequestMethod.GET)
	@ResponseBody
	public String ceshi(@RequestParam String name) {
		hService.setName(name);
		System.out.println(hService.getName());
		return name;
	}
}
